const path = require('path')

function resolve(dir) {
  return path.join(__dirname, dir)
}

module.exports = {
  publicPath: process.env.NODE_ENV === 'production' ?
    './' : './',
  chainWebpack(config) {
    // alias
    config.resolve.alias
      .set('@', resolve('src'))
      .set('assets', resolve('src/assets'))
      .set('api', resolve('src/api'))
      .set('components', resolve('src/components'))
  },
  css: {
    loaderOptions: {
      less: {
        modifyVars: {
          // 'blue': '#111111',
          // todo
          'hack': `true; @import "${path.join(__dirname, 'theme.less')}";`
        }
      }
    }
  },
  devServer: {
    disableHostCheck: true,
  }
}